package leetcode_core.leetcode_5;

/**
 * 功能描述
 *
 * @author: 张庭杰
 * @date: 2023年01月03日 0:53
 */
public class ReplaceSpaces {
    public String replaceSpaces(String S, int length) {
        StringBuilder stringBuilder = new StringBuilder();
        for(int i = 0;i<length;i++){
            if(S.charAt(i)==' '){
                stringBuilder.append("%20");
            }else{
                stringBuilder.append(S.charAt(i));
            }
        }
        return stringBuilder.toString();
    }
}
